{% extends "competitors.html" %}
{% load humanize %}

{% block title %}
  {{competitor.first_name|lower|capfirst}} {{competitor.last_name|lower|capfirst}}
{% endblock title %}

{% block description %}
  {{competitor.first_name|lower|capfirst}} {{competitor.last_name|lower|capfirst}} is a competitor participating in the 20th Chinese Martial Arts Tournament held at UC Berkeley.  
  {% if completed_events|length > 0 %}
    {% if competitor.gender.code == "M"%}He{% else %}She{%endif%} placed {% for event in completed_events %}{% if forloop.last and not forloop.first%}and {%endif%}{{event.placing.place|ordinal}} in {{event.event.event_type.name}}{% if forloop.last %}.{% else %}, {% endif %}{% endfor %}
  {% endif %}
{% endblock description %}

{% block head %}
  <meta property='og:title' content='{{competitor.first_name|lower|capfirst}} {{competitor.last_name|lower|capfirst}} - CMAT 21 Scoreboard' />
  <meta property='og:description' content='{{competitor.first_name|lower|capfirst}} {{competitor.last_name|lower|capfirst}} is a competitor participating in the 20th Chinese Martial Arts Tournament held at UC Berkeley.  {% if completed_events %}{% if competitor.gender.code == "M"%}He{% else %}She{%endif%} placed {% for event in completed_events %}{% if forloop.last and not forloop.first%}and {%endif%}{{event.placing.place|ordinal}} in {{event.event.event_type.name}}{% if forloop.last %}.{% else %}, {% endif %}{% endfor %}{% endif %}' />
  <meta property='og:type' content='profile' />
  <meta property='og:profile:first_name' content='{{competitor.first_name}}' />
  <meta property='og:profile:last_name' content='{{competitor.last_name}}' />
{% endblock %}

{% block sub_breadcrumb %}
  <li class="active">
    <a href="/competitor/{{competitor.last_name}}/{{competitor.first_name}}">
      {{competitor.first_name|lower|capfirst}} {{competitor.last_name|lower|capfirst}}
    </a>
  </li>
{% endblock %}

{% block navi_full %}
{% endblock navi_full %}

{% block content_full %}
<div class="span12">
  <div class="row">
    <div class="span4"><center>
      <h1>{{competitor.first_name|lower|capfirst}} {{competitor.last_name|lower|capfirst}}</h1><br>
      <h2>{{competitor.level.name}} - {{competitor.gender.name}} - {{competitor.age_group.name}}</h2><br><br>
      <h2>{{competitor.events.all|length}} event{{competitor.events.all|length|pluralize}}</h2><br><br>
    </center></div>
    <div class="span8">
      <ul class="nav nav-pills nav-stacked">
        {% for event in completed_events %}
          <a href="/event/{{event.event.shortcode}}">
            <div class="row">
              <div class="span2"><h3>
                {% if event.placing %}
                  {{event.placing.place|ordinal}} place
                {% else %}
                  (N/A)
                {% endif %}
              </h3></div>
              <div class="span1">
                <h3>
                  {{event.event.shortcode}}
                </h3>
              </div>
              <div class="span4">
                <strong>{{event.event.event_type.name}}</strong><br>
                  {{event.event.level.name}} - 
                  {{event.event.gender.name}} - 
                  {{event.event.age_group.name}}
              </div>
              <div class="span1">
                <span class="btn disabled">{{event.event.num_competitors}}</span>
              </div>
            </div>
          </a>
          <hr />
        {% endfor %}
        {% for event, meta in unfinished_events %}
          <a href="/event/{{event.shortcode}}">
            <div class="row">
              <div class="span2"><h3>
                {% if meta.order == 0 %}
                  Current
                {% else %}
                  {% if meta.order == 1 %}
                    Next
                  {% else %}
                    {{meta.order|ordinal}}
                  {% endif %} 
                {% endif %}
                event in Ring {{event.ring.number}}
              </h3></div>
              <div class="span1">
                <h3>
                  {{event.shortcode}}
                </h3>
              </div>
              <div class="span4">
                <strong>{{event.event_type.name}}</strong><br>
                  {{event.level.name}} - 
                  {{event.gender.name}} - 
                  {{event.age_group.name}}
              </div>
              <div class="span1">
                <span class="btn disabled">{{event.num_competitors}}</span>
              </div>
            </div>
          </a>
          <hr />
        {% endfor %}
      </ul>
    </div>
  </div>
</div>
{% endblock content_full %}